package dk.javacode.proxy;



public class NameInterceptor implements InterceptionHandler<Nameable> {
	private int beforeCalls;
	
	@Override
	public Object before(Nameable target, Object[] args) {
		beforeCalls++;
		target.setName("world!(" + beforeCalls + ")");
		return beforeCalls;
	}

	@Override
	public void after(Nameable target, Object[] args, Object chainedResult) {
		System.out.println("After: " + chainedResult);
	}

	@Override
	public Class<Nameable> accepts() {
		return Nameable.class;
	}

}
